package top.withwings.bonus.bonus.pojo;

public class Rate {

    public static final Rate NOT_APPLIED;
    public static final Rate REQUIRE_COMPUTATION;


    public static final int TYPE_NO_SUITABLE = -2;
    public static final int TYPE_NOT_APPLIED = -1;
    public static final int TYPE_REQUIRE_COMPUTATION = 0;

    public static final int TYPE_NORMAL = 1;

    static {
        NOT_APPLIED = new Rate();
        NOT_APPLIED.type = TYPE_NOT_APPLIED;
        NOT_APPLIED.value = 0;

        REQUIRE_COMPUTATION = new Rate();
        REQUIRE_COMPUTATION.type = TYPE_REQUIRE_COMPUTATION;
        REQUIRE_COMPUTATION.value = 0;

    }

    private int type;

    private double value;


    public Rate() {

    }


    public Rate(int type, double value) {
        this.type = type;
        this.value = value;
    }


    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getText() {
        switch (this.type) {
            case TYPE_NO_SUITABLE:
                return "无适用";
            case TYPE_NOT_APPLIED:
                return "N/A";
            case TYPE_REQUIRE_COMPUTATION:
                return "待计算";
            case TYPE_NORMAL:
                return "正常";

        }
        return "未知类型";
    }

    public double getValue() {
        return value;
    }

    public void setValue(double value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return "Rate{" +
                "type=" + type +
                ", value=" + value +
                '}';
    }
}
